﻿package main {
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.display.Graphics;
	import flash.text.TextField; 
	import main.*;
	
	
	dynamic public  class ship extends MovieClip{
	
	
	var vmax : Number =1.21; //speed
	var num  : Number;	
	var power  : Number;
	var dest   : Number;
	var player   : Number;
	var col  : Number;
	var txt  : TextField;
	var xn,yn,xk,yk,vx,vy,vz,yr,xr : int;
	//var dae  :  Number=0 ;
	
	public function ship (){
	  //       doubleClickEnabled=true;
	 // col=0x00DF10;
			  graphics.lineStyle(1,0x777777);
		     graphics.moveTo(0,-5);
			 graphics.lineTo(20,0);
			 graphics.lineTo(0,5);
			 graphics.lineTo(0,-5);
			 graphics.beginFill(col);
		  //   graphics.drawCircle( 0,0,20 );
			 
			 addEventListener(MouseEvent.MOUSE_DOWN, obr4);
	}
	
	 private function obr4(evt:MouseEvent):void
	 { 
   //  	trace ("ship");
	 }
	 
	 
	 public function movs ():void
	 {
		xr=xk-x;
		yr=yk-y;
	   vz=Math.sqrt(xr*xr + yr*yr);	
	   if ((vz>5)||(vz<-5)) {
	   vx=vmax*(xr/vz);
	   vy=vmax*(yr/vz);
	   x=x+vx;
	   y=y+vy; 
	   rotation=Math.atan2(yr,xr)*180/3.14; }
	   else
	   { //parent.removeChild(this) ;
	  //  dae=1;
		
	   }
	 }
	 
	 public function ris()  {
		     graphics.lineStyle(1,0x777777);
		     graphics.moveTo(0,-5);
			 graphics.lineTo(20,0);
			 graphics.lineTo(0,5);
			 graphics.lineTo(0,-5);
			 graphics.beginFill(col);
		}




	}//class
}